﻿using Microsoft.AspNetCore.Mvc;
using Nereus.Attributes;
using Newtonsoft.Json;
using System.IO;
using System.Threading.Tasks;
using Zeus.Mvc.Controllers;

namespace Nereus.Zeus.Mvc.Test
{
    [NClass(Code = "Alipay", Description = "提供PAY模块Alipay部分相关接口", Name = "Alipay接口")]
    public class NdController : ZeusController
    {

        public INBuilder _nBuilder;
        public INBuilderConfigure _nBuilderConfigure;
        private INDoucmentBuilder _nDoucmentBuilder;
        public NdController(INBuilder nBuilder, INBuilderConfigure nBuilderConfigure, INDoucmentBuilder nDoucmentBuilder)
        {
            _nBuilder = nBuilder;
            _nBuilderConfigure = nBuilderConfigure;
            _nDoucmentBuilder = nDoucmentBuilder;
        }

        


        [HttpGet]
        [NonNereus]
        [Route("nereus/power/show/doc")]
        public IActionResult PowerShowDoc()
        {
            var nDoucment = _nDoucmentBuilder.Build(_nBuilder.BuildClassContent(_nBuilderConfigure.AssemblyPathArray));
            //string filePath = "API接口文档.doc";
            return File(new FileStream(nDoucment.Path + nDoucment.Name, FileMode.Open
                ), "application/x-zip-compressed", nDoucment.Name);
        }




        [NMethod(Code = "MicroPay",
            Description = "扫码支付",
            Enable = true,
            Method = "POST",
            Name = "扫码支付",
            Argument = typeof(ArguNdTest),
            Result = typeof(PropertyTest),
            Uri = "aaa")]   
        [Route("nereus/nd/test")]
        public async Task<IActionResult> NdTest([FromBody]ArguNdTest arguNdTest)
        {
            return Ok("hello");
        }


    }
}
